cmake_minimum_required(VERSION 3.10)  
project(LiveProxy)
  
# 设置C++标准  
set(CMAKE_CXX_STANDARD 11)  
set(CMAKE_CXX_STANDARD_REQUIRED True)  

list(APPEND CMAKE_PREFIX_PATH "/usr/local/ffmpeg")

# 查找FFmpeg库  
find_package(PkgConfig REQUIRED)  
pkg_check_modules(FFMPEG REQUIRED libavformat libavcodec libavutil libswscale)  
  
# 包含目录  
include_directories(${FFMPEG_INCLUDE_DIRS})  
include_directories(    /usr/local/ffmpeg/include/libavcodec
    /usr/local/ffmpeg/include/libavdevice
    /usr/local/ffmpeg/include/libavfilter
    /usr/local/ffmpeg/include/libavformat
    /usr/local/ffmpeg/include/libavutil
    /usr/local/ffmpeg/include/libpostproc
    /usr/local/ffmpeg/include/libswresample
    /usr/local/ffmpeg/include/libswscale
)  

link_libraries(${FFMPEG_LIBRARIES})
link_directories(/usr/local/ffmpeg/lib)

# 添加可执行文件  
add_executable(live_proxy main.cc)  
  
# 链接库  
target_link_libraries(live_proxy ${FFMPEG_LIBRARIES})
#target_link_libraries(live_proxy /usr/local/ffmpeg/lib)


set(OpenCV_DIR "/root/opencv-3.4.16/build/")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(live_proxy ${OpenCV_LIBS})


#add_executable(receive receive.cc)
#target_link_libraries(receive ${OpenCV_LIBS})

find_package(Threads REQUIRED)
target_link_libraries(live_proxy ${CMAKE_THREAD_LIBS_INIT})

